package com.china08.yxyapi.api.manage.sch.platform.website.template;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.model.YxyApiReqModel;
import com.china08.yxyapi.model.YxyApiRespModel;

@CrossOrigin
@RestController
public class SwsColorListController extends YxyApiBaseController {

    @RequestMapping(value = "/api_yw/manage/sch/platform/website/template/color/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Object precess(HttpServletRequest request, HttpServletResponse response, @RequestBody(required = false) ReqModel reqModel) {

        List<Map<String, Object>> colorList = new ArrayList<Map<String, Object>>();

        // 模版id
        String templId = reqModel.templId;
        // 主题id
        String themeId = reqModel.themeId;
        Assert.isTrue(StringUtils.isNotBlank(templId), "模版id为空");
        Assert.isTrue(StringUtils.isNotBlank(themeId), "主题id为空");

        // ###
        // 模版一
        if (templId.equals("templ001")) {
            // 主题一
            if (themeId.equals("theme001")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ001");
                m1.put("colorThemeId", "theme001");
                m1.put("colorImg", "/static/img/website/color/templ001-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ001-theme001-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ001");
                m2.put("colorThemeId", "theme001");
                m2.put("colorImg", "/static/img/website/color/templ001-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ001-theme001-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ001");
                m3.put("colorThemeId", "theme001");
                m3.put("colorImg", "/static/img/website/color/templ001-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ001-theme001-color003.jpg");

                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ001");
                m4.put("colorThemeId", "theme001");
                m4.put("colorImg", "/static/img/website/color/templ001-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ001-theme001-color004.jpg");

                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ001");
                m5.put("colorThemeId", "theme001");
                m5.put("colorImg", "/static/img/website/color/templ001-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ001-theme001-color005.jpg");

                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
            if (themeId.equals("theme002")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ001");
                m1.put("colorThemeId", "theme002");
                m1.put("colorImg", "/static/img/website/color/templ001-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ001-theme002-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ001");
                m2.put("colorThemeId", "theme002");
                m2.put("colorImg", "/static/img/website/color/templ001-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ001-theme002-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ001");
                m3.put("colorThemeId", "theme002");
                m3.put("colorImg", "/static/img/website/color/templ001-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ001-theme002-color003.jpg");

                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ001");
                m4.put("colorThemeId", "theme002");
                m4.put("colorImg", "/static/img/website/color/templ001-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ001-theme002-color004.jpg");

                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ001");
                m5.put("colorThemeId", "theme002");
                m5.put("colorImg", "/static/img/website/color/templ001-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ001-theme002-color005.jpg");

                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
            if (themeId.equals("theme003")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ001");
                m1.put("colorThemeId", "theme003");
                m1.put("colorImg", "/static/img/website/color/templ001-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ001-theme003-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ001");
                m2.put("colorThemeId", "theme003");
                m2.put("colorImg", "/static/img/website/color/templ001-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ001-theme003-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ001");
                m3.put("colorThemeId", "theme003");
                m3.put("colorImg", "/static/img/website/color/templ001-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ001-theme003-color003.jpg");

                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ001");
                m4.put("colorThemeId", "theme003");
                m4.put("colorImg", "/static/img/website/color/templ001-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ001-theme003-color004.jpg");

                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ001");
                m5.put("colorThemeId", "theme003");
                m5.put("colorImg", "/static/img/website/color/templ001-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ001-theme003-color005.jpg");

                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
        }

        // ###
        // 模版二
        if (templId.equals("templ002")) {
            if (themeId.equals("theme001")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ002");
                m1.put("colorThemeId", "theme001");
                m1.put("colorImg", "/static/img/website/color/templ002-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ002-theme001-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ002");
                m2.put("colorThemeId", "theme001");
                m2.put("colorImg", "/static/img/website/color/templ002-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ002-theme001-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ002");
                m3.put("colorThemeId", "theme001");
                m3.put("colorImg", "/static/img/website/color/templ002-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ002-theme001-color003.jpg");
                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ002");
                m4.put("colorThemeId", "theme001");
                m4.put("colorImg", "/static/img/website/color/templ002-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ002-theme001-color004.jpg");
                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ002");
                m5.put("colorThemeId", "theme001");
                m5.put("colorImg", "/static/img/website/color/templ002-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ002-theme001-color005.jpg");

                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
            if (themeId.equals("theme002")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ002");
                m1.put("colorThemeId", "theme002");
                m1.put("colorImg", "/static/img/website/color/templ002-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ002-theme002-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ002");
                m2.put("colorThemeId", "theme002");
                m2.put("colorImg", "/static/img/website/color/templ002-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ002-theme002-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ002");
                m3.put("colorThemeId", "theme002");
                m3.put("colorImg", "/static/img/website/color/templ002-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ002-theme002-color003.jpg");
                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ002");
                m4.put("colorThemeId", "theme002");
                m4.put("colorImg", "/static/img/website/color/templ002-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ002-theme002-color004.jpg");
                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ002");
                m5.put("colorThemeId", "theme002");
                m5.put("colorImg", "/static/img/website/color/templ002-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ002-theme002-color005.jpg");
                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
            if (themeId.equals("theme003")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ002");
                m1.put("colorThemeId", "theme003");
                m1.put("colorImg", "/static/img/website/color/templ002-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ002-theme003-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ002");
                m2.put("colorThemeId", "theme003");
                m2.put("colorImg", "/static/img/website/color/templ002-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ002-theme003-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ002");
                m3.put("colorThemeId", "theme003");
                m3.put("colorImg", "/static/img/website/color/templ002-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ002-theme003-color003.jpg");
                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ002");
                m4.put("colorThemeId", "theme003");
                m4.put("colorImg", "/static/img/website/color/templ002-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ002-theme003-color004.jpg");
                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ002");
                m5.put("colorThemeId", "theme003");
                m5.put("colorImg", "/static/img/website/color/templ002-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ002-theme003-color005.jpg");
                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
            if (themeId.equals("theme004")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ002");
                m1.put("colorThemeId", "theme004");
                m1.put("colorImg", "/static/img/website/color/templ002-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ002-theme004-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ002");
                m2.put("colorThemeId", "theme004");
                m2.put("colorImg", "/static/img/website/color/templ002-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ002-theme004-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ002");
                m3.put("colorThemeId", "theme004");
                m3.put("colorImg", "/static/img/website/color/templ002-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ002-theme004-color003.jpg");
                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ002");
                m4.put("colorThemeId", "theme004");
                m4.put("colorImg", "/static/img/website/color/templ002-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ002-theme004-color004.jpg");
                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ002");
                m5.put("colorThemeId", "theme004");
                m5.put("colorImg", "/static/img/website/color/templ002-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ002-theme004-color005.jpg");
                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
            if (themeId.equals("theme005")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ002");
                m1.put("colorThemeId", "theme005");
                m1.put("colorImg", "/static/img/website/color/templ002-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ002-theme005-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙色");
                m2.put("colorTemplId", "templ002");
                m2.put("colorThemeId", "theme005");
                m2.put("colorImg", "/static/img/website/color/templ002-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ002-theme005-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "红色");
                m3.put("colorTemplId", "templ002");
                m3.put("colorThemeId", "theme005");
                m3.put("colorImg", "/static/img/website/color/templ002-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ002-theme005-color003.jpg");
                Map<String, Object> m4 = new HashMap<>();
                m4.put("colorId", "color004");
                m4.put("colorName", "绿色");
                m4.put("colorTemplId", "templ002");
                m4.put("colorThemeId", "theme005");
                m4.put("colorImg", "/static/img/website/color/templ002-icon-4.png");
                m4.put("colorIfImg", "/static/img/website/color/templ002-theme005-color004.jpg");
                Map<String, Object> m5 = new HashMap<>();
                m5.put("colorId", "color005");
                m5.put("colorName", "紫色");
                m5.put("colorTemplId", "templ002");
                m5.put("colorThemeId", "theme005");
                m5.put("colorImg", "/static/img/website/color/templ002-icon-5.png");
                m5.put("colorIfImg", "/static/img/website/color/templ002-theme005-color005.jpg");
                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
                colorList.add(m4);
                colorList.add(m5);
            }
        }

        // ###
        // 模版三绿 橙 蓝
        if (templId.equals("templ101")) {
            if (themeId.equals("theme001")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "绿");
                m1.put("colorTemplId", "templ101");
                m1.put("colorThemeId", "theme001");
                m1.put("colorImg", "/static/img/website/color/templ101-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ101-theme001-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙 ");
                m2.put("colorTemplId", "templ101");
                m2.put("colorThemeId", "theme001");
                m2.put("colorImg", "/static/img/website/color/templ101-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ101-theme001-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "蓝");
                m3.put("colorTemplId", "templ101");
                m3.put("colorThemeId", "theme001");
                m3.put("colorImg", "/static/img/website/color/templ101-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ101-theme001-color003.jpg");
                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
            }
            if (themeId.equals("theme002")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "绿");
                m1.put("colorTemplId", "templ101");
                m1.put("colorThemeId", "theme002");
                m1.put("colorImg", "/static/img/website/color/templ101-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ101-theme002-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙");
                m2.put("colorTemplId", "templ101");
                m2.put("colorThemeId", "theme002");
                m2.put("colorImg", "/static/img/website/color/templ101-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ101-theme002-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "蓝");
                m3.put("colorTemplId", "templ101");
                m3.put("colorThemeId", "theme002");
                m3.put("colorImg", "/static/img/website/color/templ101-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ101-theme002-color003.jpg");
                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
            }
            if (themeId.equals("theme003")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "绿");
                m1.put("colorTemplId", "templ101");
                m1.put("colorThemeId", "theme003");
                m1.put("colorImg", "/static/img/website/color/templ101-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ101-theme003-color001.jpg");

                Map<String, Object> m2 = new HashMap<>();
                m2.put("colorId", "color002");
                m2.put("colorName", "橙");
                m2.put("colorTemplId", "templ101");
                m2.put("colorThemeId", "theme003");
                m2.put("colorImg", "/static/img/website/color/templ101-icon-2.png");
                m2.put("colorIfImg", "/static/img/website/color/templ101-theme003-color002.jpg");

                Map<String, Object> m3 = new HashMap<>();
                m3.put("colorId", "color003");
                m3.put("colorName", "蓝");
                m3.put("colorTemplId", "templ101");
                m3.put("colorThemeId", "theme003");
                m3.put("colorImg", "/static/img/website/color/templ101-icon-3.png");
                m3.put("colorIfImg", "/static/img/website/color/templ101-theme003-color003.jpg");
                colorList.add(m1);
                colorList.add(m2);
                colorList.add(m3);
            }
        }

        if (templId.equals("templ003")) {
            if (themeId.equals("theme001")) {
                Map<String, Object> m1 = new HashMap<>();
                m1.put("colorId", "color001");
                m1.put("colorName", "蓝色");
                m1.put("colorTemplId", "templ003");
                m1.put("colorThemeId", "theme001");
                m1.put("colorImg", "/static/img/website/color/templ003-icon-1.png");
                m1.put("colorIfImg", "/static/img/website/color/templ003-theme001-color001.jpg");
                colorList.add(m1);
            }
        }
        RespModel resModel = new RespModel();
        resModel.colorList = colorList;
        return resModel;
    }

    protected static class ReqModel extends YxyApiReqModel {
        public String templId;
        public String themeId;
    }

    protected class RespModel extends YxyApiRespModel {
        public List<Map<String, Object>> colorList;
    }
}
